<!DOCTYPE html>
<!--
     SPDX-License-Identifier: CC-BY-SA-4.0
     SPDX-FileCopyrightText: 2020 seL4 Project a Series of LF Projects, LLC.
-->
<!-- Page last generated 2025-02-20 03:16:15 +0000 -->
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>CAmkES VMM | seL4 docs</title>

    <!-- Our stylesheet and theme stylesheet.  Contains bootstrap. -->
    <link rel="stylesheet" href="/assets/css/style.css" type="text/css">
    <!-- Font awesome -->
    <link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
    <!-- Pygments syntax highlighting  -->
    <link rel="stylesheet" href="/assets/css/highlighting/trac.css" type="text/css">
    <link rel="icon" type="image/x-icon" href="/assets/favicon.ico"><script defer data-domain="docs.sel4.systems"
	    src="https://analytics.sel4.systems/js/script.js"></script></head>

  <body class="container-fluid">

    



<header>
  <ul class="row menu">
    <li class="col-xs-12 col-md-2" >
            <a href="https://sel4.systems" class="skip-icon">
              <img class="img-responsive" src="/assets/logo-text-white.svg" alt="seL4 logo" />
            </a>
    </li>
    <li class="col-xs-12 col-md-10 menu">
      <nav aria-label="Banner links">
        <h2><a href="/Resources" />Resources</h2>
        <h2><a href="/processes" />Contributing</a></h2>
        <h2><a href="/projects" />Projects</h2>
        <h2><a href="/Tutorials" />Tutorials</h2>
        <iframe title="DuckDuckGo search bar" src="https://duckduckgo.com/search.html?site=docs.sel4.systems&prefill=Search%20sel4.systems" style="overflow:hidden;margin-bottom:10px; padding:0;height:40px;float:right;border-width: 0px"></iframe>
      </nav>
    </li>
  </ul>
  <div class="clear"></div>
  
<div class="breadcrumbs bootstrap hidden-sm-down">
  <nav class="sel-breadcrumb" aria-label="Breadcrumb" >
    <ol class=" list-unstyled" vocab="http://schema.org/" typeof="BreadcrumbList">
      
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/">
              <span property="name"><b>seL4 Docs</b></span>
            </a>
            <meta property="position" content="1" />
        </li>
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/projects/">
              <span property="name"><b>Projects</b></span>
            </a>
            <meta property="position" content="2" />
        </li>
      
        

        
          <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <span property="name">CAmkES VMM</span>
            <meta property="position" content="3" /></li>
          
    </ol>
  </nav>
  <nav class="sel-version" aria-label="Current Versions">
    <ol class="list-unstyled">
      <li class="list-unstyled text-right" style="margin-left:auto; padding:0rem 0rem;">
        Current versions:</li>
      <li class="list-unstyled text-right">
      <a href="/releases/sel4/13.0.0"><b>seL4-13.0.0</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/microkit/1.4.1"><b>microkit-1.4.1</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/camkes/camkes-3.11.0"><b>camkes-3.11.0</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/capdl/0.3.0"><b>capDL-0.3.0</b></a></li>
      </ol>
  </nav>
  <div class='clear'></div>
</div>


</header>

    <main>
      <div class="row">
  <div class="hidden-xs col-sm-4 col-md-3 col-lg-2">
    


<div class="sidebar">















    <ul class="nav nav-sidebar">
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4/">seL4</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/l4v/">L4.verified</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/camkes/">CAmkES</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/capdl/">CapDL</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/elfloader/">Elfloader</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/buildsystem/">seL4 Buildsystem</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/user_libs/">user_libs</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4runtime/">The seL4 run-time</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4webserver/">seL4webserver</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4-tutorials/">seL4 tutorials</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4bench/">sel4bench</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4test/">seL4Test</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/virtualization/">Virtualization</a>
        </li>
  
    
    

    
        <li class="active">
            <a class="" href="/projects/camkes-vm/">camkes-vm</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/dockerfiles/">Dockerfiles</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/docsite/">seL4 Documentation website</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4_tools/">seL4_tools</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/microkit/">Microkit</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/hardware_hacks/">Hardware Hacks</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/rust/">Rust</a>
        </li>
  
    </ul>


</div>

  </div>
  <div class="content col-sm-8 col-md-6 col-lg-7 main">
    <h1 id="camkes-vmm">CAmkES VMM</h1>

<!--
  Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)

  SPDX-License-Identifier: CC-BY-SA-4.0
-->

<h1 id="camkes-vm-apps">camkes-vm-apps</h1>

<p>This project is for running virtualised Linux guests on seL4 for ARM and x86 platforms. The <code class="language-plaintext highlighter-rouge">camkes-vm</code> implements
a virtual machine monitor (VMM) server, facilitating the initialisation, booting and run-time management of a guest OS.
You can view the code for the VMMs in the <code class="language-plaintext highlighter-rouge">camkes-vm</code> repository under <code class="language-plaintext highlighter-rouge">VM_Arm</code> and <code class="language-plaintext highlighter-rouge">VM</code>.</p>

<p>Currently the supported platforms include:</p>

<ul>
  <li>Exynos5 (exynos5410, exynos5422)</li>
  <li>TK1</li>
  <li>TX1</li>
  <li>TX2</li>
  <li>QEMU ARM virt machine</li>
  <li>ZCU102</li>
  <li>x86</li>
  <li>x86_64</li>
</ul>

<h2 id="getting-and-building">Getting and Building</h2>

<h3 id="cloning-the-repository-set-and-preparing-a-build-directory">Cloning the repository set and preparing a build directory</h3>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>repo init <span class="nt">-u</span> https://github.com/seL4/camkes-vm-examples-manifest.git
repo <span class="nb">sync
mkdir </span>build
<span class="nb">cd </span>build
</code></pre></div></div>

<p>Arm and x86 have slightly differing build instructions. See the sections below.</p>

<h3 id="building-for-arm">Building for Arm</h3>

<p>The following example builds the CAmkES Arm VMM for the TK1. In the <code class="language-plaintext highlighter-rouge">build</code> directory, run:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>../init-build.sh <span class="nt">-DCAMKES_VM_APP</span><span class="o">=</span>vm_minimal <span class="nt">-DPLATFORM</span><span class="o">=</span>tk1
ninja
</code></pre></div></div>

<p><em>Note: To buid for another platform you can substitute the value of the <code class="language-plaintext highlighter-rouge">-DPLATFORM</code> variable e.g. (exynos5422, tx1, tx2, zcu102, qemu-arm-virt)</em></p>

<p>An EFI application file will be left in <code class="language-plaintext highlighter-rouge">images/capdl-loader-image-arm-tk1</code> We normally boot using TFTP, by first copying <code class="language-plaintext highlighter-rouge">capdl-loader-image-arm-tk1</code> to a tftpserver then on the U-Boot serial console doing:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dhcp
tftpboot <span class="k">${</span><span class="nv">loadaddr</span><span class="k">}</span> /capdl-loader-image-arm-tk1
bootefi <span class="k">${</span><span class="nv">loadaddr</span><span class="k">}</span>
</code></pre></div></div>

<h3 id="building-for-x86">Building for x86</h3>

<p>The following example builds the CAmkES VMM for x64. In the <code class="language-plaintext highlighter-rouge">build</code> directory, run:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>../init-build.sh <span class="nt">-DCAMKES_VM_APP</span><span class="o">=</span>minimal_64
ninja
</code></pre></div></div>

<p>Boot <code class="language-plaintext highlighter-rouge">images/kernel-x86_64-pc99</code> and <code class="language-plaintext highlighter-rouge">images/capdl-loader-image-x86_64-pc99</code> with the multiboot boot loader of your choice. Use <code class="language-plaintext highlighter-rouge">*.ia32-pc99</code> if built for 32-bit with <code class="language-plaintext highlighter-rouge">../init-build.sh -DCAMKES_VM_APP=minimal</code>.</p>

<h2 id="camkes-arm-vmm-applications">CAmkES ARM VMM Applications</h2>

<p>This project contains various reference CAmkES applications that incorporate the VMM component. These applications include:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vm_minimal</code>: A simple VMM application, launching a single guest Linux with a buildroot RAM-based file system</li>
  <li><code class="language-plaintext highlighter-rouge">vm_cross_connector</code>: Application demonstrating communication between a Linux guest user-level process and a native seL4 component. This leveraging
cross vm communication channels established between the VMM and the seL4 component.</li>
  <li><code class="language-plaintext highlighter-rouge">vm_multi</code>: Application demonstrating running multiple guest VM’s. This is achieved through having multiple VMM components, each managing a single
Linux guest (1-1 model).</li>
  <li><code class="language-plaintext highlighter-rouge">vm_serial_server</code>: Application demonstrating the use of Virtio Console, where a VM’s serial I/O is forwarded to/from a serial server.</li>
  <li><code class="language-plaintext highlighter-rouge">vm_virtio_net</code>: Application demonstrating the use of Virtio Net, where a virtual network interface is presented to a VM and subsequent network
traffic on the virtual network interface is sent to/from other native seL4 components.</li>
</ul>

<p>See the <code class="language-plaintext highlighter-rouge">apps/Arm/</code> subdirectory for all the supported virtual machine manager apps, their implementations and the platforms they target.</p>

<h2 id="camkes-x86-vmm-applications">CAmkES x86 VMM Applications</h2>

<ul>
  <li>
    <p>The <code class="language-plaintext highlighter-rouge">minimal</code> application is a simple CAmkES VM application. The application is configured with:</p>

    <ul>
      <li><em>1 Guest Linux VM:</em> The Linux guest is a <a href="https://buildroot.org/">buildroot</a> built image sourced from the <a href="https://github.com/seL4/camkes-vm">the camkes-vm repo</a>. The Linux images (rootfs and kernel) are defined in the <code class="language-plaintext highlighter-rouge">CMakeLists.txt</code> file of the <code class="language-plaintext highlighter-rouge">minimal</code> application. In the <code class="language-plaintext highlighter-rouge">CMakeLists.txt</code> file we are able to find that the rootfs and kernel images  are added to the <code class="language-plaintext highlighter-rouge">FileServer</code> under the names <code class="language-plaintext highlighter-rouge">"rootfs.cpio"</code> and  <code class="language-plaintext highlighter-rouge">"bzimage"</code> respectively.</li>
    </ul>
  </li>
  <li>
    <p>The <code class="language-plaintext highlighter-rouge">optiplex9020</code> VM application is configured with:</p>

    <ul>
      <li><em>2 Guest Linux VM’s:</em> The Linux guests are <a href="https://buildroot.org/">buildroot</a> built images sourced from the <a href="https://github.com/seL4/camkes-vm">the camkes-vm repo</a>.</li>
      <li>
        <p><em>Cross VM Connectors:</em> To demo the use of cross-vm connectors a series of shared dataports and events are established between <code class="language-plaintext highlighter-rouge">vm0</code> and the <code class="language-plaintext highlighter-rouge">StringReverse</code> component. The <code class="language-plaintext highlighter-rouge">StringReverse</code> demo can be invoked from the command-line of <code class="language-plaintext highlighter-rouge">vm0</code>:</p>

        <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Welcome to Buildroot
buildroot login: root
Password:
\# string_reverse
[   19.739028] dataport received mmap for minor 1
[   19.743337] dataport received mmap for minor 2
hello
olleh
</code></pre></div>        </div>
      </li>
    </ul>
  </li>
  <li>
    <p>The <code class="language-plaintext highlighter-rouge">cma34cr_centos</code> application is a more complex CAmkES VM configuration demonstrating the use of passthrough hardware. The <code class="language-plaintext highlighter-rouge">cma34cr_centos</code> application is configured with:</p>

    <ul>
      <li><em>1 Guest Linux VM:</em> The Linux guest images (<code class="language-plaintext highlighter-rouge">bzimage</code> and <code class="language-plaintext highlighter-rouge">roofs.cpio</code>) are located in the applications directory (<code class="language-plaintext highlighter-rouge">cma34cr_centos/centos_linux</code>), originally sourced from an i386 altarch CentOS-7 installation. Additionally the CentosOS installation should be on a flash drive passed-through to the <code class="language-plaintext highlighter-rouge">cma34cr</code> application. Further information regarding the Linux installation can be found in the applications <a href="https://github.com/seL4/camkes-vm-examples/blob/master/apps/x86/cma34cr_centos/README.md">README</a>.</li>
      <li><em>Cross VM Connectors:</em> A series of shared dataports and events are established between <code class="language-plaintext highlighter-rouge">vm0</code> and the <code class="language-plaintext highlighter-rouge">StringReverse</code> component.</li>
      <li><em>Ethernet Driver, UDPSever, Echo, Firewall:</em> A passthrough ethernet configuration demo. The guest VM is configured to use the Ethernet driver component through a virtio configuration.</li>
      <li><em>Passthrough hardware storage (SATA/USB)</em>: A hardware configuration to boot the CentOS installation.</li>
    </ul>
  </li>
  <li>
    <p>The <code class="language-plaintext highlighter-rouge">zmq_samples</code> application demonstrates messaging between VMs using the ZeroMQ messaging library.
See the README.md in its folder for more information.</p>
  </li>
</ul>

<p>See the <code class="language-plaintext highlighter-rouge">apps/x86/</code> subdirectory for all the supported virtual machine manager apps, their implementations and the platforms they target.</p>

<h2 id="arm-features">Arm Features</h2>

<p>See the below feature matrix for the various features the CAmkES ARM VMM implements/facilitates across the various supported platforms.</p>

<table>
  <thead>
    <tr>
      <th style="text-align: center">Plaform</th>
      <th style="text-align: center">Guest Mode</th>
      <th style="text-align: center">SMP Support</th>
      <th style="text-align: center">Multiple VM Support</th>
      <th style="text-align: center">Virtio PCI</th>
      <th style="text-align: center">Virtio Console</th>
      <th style="text-align: center">Virtio Net</th>
      <th style="text-align: center">Cross VM Connector Support</th>
      <th style="text-align: center"><em>Notes</em></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: center">exynos5422</td>
      <td style="text-align: center">32-bit</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">SMP configurations are unsupported due to: * No exynos5422 kernel SMP support * No virtual power device interface to manage VCPU’s at runtime (e.g. core startup)</td>
    </tr>
    <tr>
      <td style="text-align: center">TK1</td>
      <td style="text-align: center">32-bit</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">SMP configurations are unsupported due to: * No TK1 kernel SMP support * No virtual power device interface to manage VCPU’s at runtime (e.g. core startup) Virtio PCI, Console, Net, Cross VM connector support &amp; Multi-VM are untested</td>
    </tr>
    <tr>
      <td style="text-align: center">TX1</td>
      <td style="text-align: center">64-bit</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Virtio PCI, Console, Net, Cross VM connector support &amp; Multi-VM are untested</td>
    </tr>
    <tr>
      <td style="text-align: center">TX2</td>
      <td style="text-align: center">64-bit</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Cross VM connector support is untested</td>
    </tr>
    <tr>
      <td style="text-align: center">ZCU102</td>
      <td style="text-align: center">64-bit</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Cross VM connector support is untested</td>
    </tr>
    <tr>
      <td style="text-align: center">QEMU Virt</td>
      <td style="text-align: center">64-bit</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Unsupported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Supported</td>
      <td style="text-align: center">Multi-VM support depends on porting the TimeServer to QEMU (See https://github.com/sel4/global-components/tree/master/components/TimeServer)</td>
    </tr>
  </tbody>
</table>

<h2 id="arm-platform-configuration-notes">Arm Platform Configuration Notes</h2>

<h3 id="exynos5422-tx1-tx2-zcu102-qemu-arm-virt-configuration">Exynos5422, TX1, TX2, ZCU102, QEMU ARM Virt configuration</h3>

<p>We provide a pre-built Linux image and Buildroot image for our guest VM’s. See the images in the <code class="language-plaintext highlighter-rouge">camkes-vm-images</code> repository at <a href="https://github.com/sel4/camkes-vm-images">https://github.com/sel4/camkes-vm-images</a>.
Feel free also to compile your own Linux and Rootfs images, see the README’s in each platform subdirectory (within <code class="language-plaintext highlighter-rouge">camkes-vm-images</code>) for information about our
image build configurations.</p>

<h3 id="tk1-configuration">TK1 configuration</h3>

<p>We currently provide two linux binaries and two device tree configurations.</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">linux-tk1-debian</code> will try and load a debian userspace off of an emmc partition</li>
  <li><code class="language-plaintext highlighter-rouge">linux-tk1-initrd</code> will load an included buildroot ramdisk</li>
  <li><code class="language-plaintext highlighter-rouge">linux-tk1-secure.dts</code> is a device tree configuration with the devices that aren’t provided to the linux are disabled.</li>
  <li><code class="language-plaintext highlighter-rouge">linux-tk1-nonsecured.dts</code> is a device tree configuration with all devices enabled.</li>
</ul>

<p>In the tk1 app configuration there is a <code class="language-plaintext highlighter-rouge">boot mode selection</code> option that chooses between the two linux binaries, and
an <code class="language-plaintext highlighter-rouge">Insecure</code> option which selects whether to provide all hardware devices to the linux vm or not. If <code class="language-plaintext highlighter-rouge">Insecure</code> is not set
then the VM will only be provided a minimal amount of hardware frames and the <code class="language-plaintext highlighter-rouge">linux-tk1-secure.dts</code> DTS will be used.  If <code class="language-plaintext highlighter-rouge">Insecure</code>
is set then the VM will be provided all device frames apart from the Memory controller and the <code class="language-plaintext highlighter-rouge">linux-tk1-nonsecured.dts</code> DTS will be used.</p>

<p>U-Boot is required to initialise the USB devices if <code class="language-plaintext highlighter-rouge">linux-tk1-secure.dts</code> is used.  This is done by: <code class="language-plaintext highlighter-rouge">usb start 0</code>.</p>

<p>The tk1 currently uses linux binaries constructed using <a href="https://buildroot.org/downloads/">Buildroot 2016.08.1</a> with the following configs:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">buildroot_tk1_initrd_defconfig</code> builds linux with an included ramdisk that will be loaded at boot.</li>
  <li><code class="language-plaintext highlighter-rouge">buildroot_tk1_emmc_defconfig</code> builds linux without a ramdisk and it will mount and run /sbin/init /dev/mmcblk0p2</li>
</ul>

<p>To copy the files back into this project, change into the Linux directory and run make for each file as shown below. <strong>Note that you can only
update one of linux-tk1-debian or linux-tk1-initrd at a time as they are built from different Buildroot configs</strong>:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd </span>projects/vm/linux
<span class="nv">LINUX_FILE</span><span class="o">=</span>linux-tk1-initrd <span class="nv">BUILDROOT_DIR</span><span class="o">=</span>~/workspaces/buildroot-2016.08.1/ make
<span class="nv">LINUX_FILE</span><span class="o">=</span>linux-tk1-dtb-secure <span class="nv">BUILDROOT_DIR</span><span class="o">=</span>~/workspaces/buildroot-2016.08.1/ make
</code></pre></div></div>

<p>Both of these configs use the tegra124-jetson-tk1-sel4vm-secure device tree file.
To change to the tegra124-jetson-tk1-sel4vm.dts this will need to be changed in the buildroot make menuconfig.
To change the mounted emmc partition the chosen dts file’s bootargs entry will need to be updated.</p>

<p>The Linux version used can be found in the seL4 branch of our <a href="https://github.com/SEL4PROJ/linux-tegra/tree/sel4">linux-tegra repo</a>.</p>

<p>When buildroot starts:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>buildroot login: root
#
</code></pre></div></div>

<p>When debian starts:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Debian GNU/Linux 8 tk1 ttyS0
tk1 login: root
Password: root
root@tk1:~#
</code></pre></div></div>

<h4 id="wireless-configuration">Wireless Configuration</h4>

<p>To configure the Ralink 2780 USB wifi dongle:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ifconfig wlan0 up
iw wlan0 scan
wpa_passphrase SSID_NAME <span class="o">&gt;&gt;</span> /etc/wpa_supplicant.conf
  ENTER_SSID_PASSPHRASE
wpa_supplicant <span class="nt">-B</span> <span class="nt">-i</span> wlan0 <span class="nt">-c</span> /etc/wpa_supplicant.conf
iw wlan0 <span class="nb">link
</span>dhclient wlan0
</code></pre></div></div>

<h3 id="tk1-build-notes">TK1 Build Notes</h3>

<p>The default setup does not pass though many devices to the Linux kernel. If you <code class="language-plaintext highlighter-rouge">make menuconfig</code> you can set <code class="language-plaintext highlighter-rouge">insecure</code> mode in the <code class="language-plaintext highlighter-rouge">Applications</code> submenu; this is meant to pass through all devices, but not
everything has been tested and confirmed to work yet. In particular, the SMMU needs to have extra entries added for any DMA-capable devices such as SATA.</p>

<h2 id="useful-links-for-developing-vm-applications">Useful Links for Developing VM Applications</h2>

<ol>
  <li><a href="/Tutorials/camkes-vm-linux.html">CAmkES VM: Adding a Linux Guest</a></li>
  <li><a href="/Tutorials/camkes-vm-crossvm.html">CAmkES VM: Cross VM Connectors</a></li>
</ol>

<h2 id="arm-faq-and-implementation-notes">Arm FAQ and Implementation Notes</h2>

<h3 id="how-do-i-update-camkes-vm-apps-to-support-platform-x">How do I update camkes-vm-apps to support platform ‘X’</h3>

<p>Whilst large parts of the ARM VMM implementation tries to be platform agnostic, there are a few things to keep in mind and implement in order to correctly run the camkes-arm-vm on your new target platform.
See the below list as as a rough list of items to check off:</p>

<ul>
  <li>Ensure the platform is already supported by seL4 (or you have developed support for the platform prior). See the <a href="/Hardware/">following</a> page for a list of supported platforms.</li>
  <li>The platform supports ARM’s hardware virtualisation features, these being found on ARMv7 (with virtualisation extensions) and ARMv8.
    <ul>
      <li>Second to this, the seL4 port to the given platform also supports running with <code class="language-plaintext highlighter-rouge">KernelArmHypervisorSupport</code></li>
    </ul>
  </li>
  <li>Does your platform use a GICv2 or GICv3? <em>Note: We currently only support a virtual GICV2, with virtual GICV3 support under-development. See the listed features of libsel4vm for further information: https://github.com/sel4/seL4_projects_libs/tree/master/libsel4vm</em></li>
  <li>When porting a VMM application to your platform, say <code class="language-plaintext highlighter-rouge">vm_minimal</code>, ensure you provide the following:
    <ul>
      <li>A <code class="language-plaintext highlighter-rouge">devices.camkes</code> file for your platform. These containing platform specific definitions, see in particular the vm <code class="language-plaintext highlighter-rouge">dtb</code> field and the <code class="language-plaintext highlighter-rouge">untyped_mmios</code> field (for device passthrough). The values in the aforementioned fields corresponding with those found in the kernel device tree.</li>
      <li>A <code class="language-plaintext highlighter-rouge">vmlinux.h</code> header for you platform. See the header file for the other supported platforms at <code class="language-plaintext highlighter-rouge">components/VM_Arm/plat_include</code> in <code class="language-plaintext highlighter-rouge">camkes-vm</code> repository.</li>
    </ul>
  </li>
  <li>Provide a pre-compiled Linux kernel and initrd image for your platform. Once compiled these are usually linked in through your apps <code class="language-plaintext highlighter-rouge">CMakeLists.txt</code>. See <code class="language-plaintext highlighter-rouge">apps/Arm/vm_minimal/CMakeLists.txt</code> for examples of how other platforms link in their images.</li>
</ul>

<p>Feel free to contact the <a href="/processes/#contact">team</a> for further support on porting the camkes-arm-vm to your desired platform. We are also always open to contributions for new platforms.</p>

<h3 id="can-a-single-vmm-component-support-running-multiple-vms">Can a single VMM component support running multiple VM’s?</h3>

<p>Currently, No. A VMM component only creates and manages a single VM instance.
To support multiple VM’s, you can run multiple VMM components, each managing its own VM. See <code class="language-plaintext highlighter-rouge">apps/vm_multi</code> for an example of this configuration.</p>

<h3 id="how-do-i-enable-smp-support-for-a-vm-instance">How do I enable SMP support for a VM instance?</h3>

<p>To configure your VM with multiple VCPU’s, you can set the VM instance attribute <code class="language-plaintext highlighter-rouge">num_vcpus</code> in your camkes configuration. See <a href="https://github.com/sel4/camkes-vm-apps/blob/master/apps/Arm/vm_minimal/tx2/devices.camkes#L40">here</a> for an example.
In addition, when initialising your build, ensure the <code class="language-plaintext highlighter-rouge">KernelMaxNumNodes</code> configuration option is set to your desired value. You can also initialise your build with variable <code class="language-plaintext highlighter-rouge">-DNUM_NODES</code> variable e.g.</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>../init-build.sh <span class="nt">-DCAMKES_VM_APP</span><span class="o">=</span>vm_minimal <span class="nt">-DPLATFORM</span><span class="o">=</span>tx2 <span class="nt">-DNUM_NODES</span><span class="o">=</span>4
</code></pre></div></div>

<p><em>Note: ensure your platform supports SMP configurations through the above feature matrix</em></p>

<p><em>File included from <a href="https://github.com/sel4/camkes-vm-examples/blob/master/README.md">github repo</a> <a href="https://github.com/sel4/camkes-vm-examples/edit/master/README.md">edit</a></em></p>

<h2 id="camkes-x86-vm">CAmkES x86 VM</h2>

<h3 id="prerequisites">Prerequisites</h3>

<ul>
  <li>Get the dependencies for building CAmkES by following
the instructions <a href="HostDependencies#camkes-build-dependencies">here</a></li>
  <li>Your host machine has to have a CPU that supports Vt-x virtualization
 (for Intel CPUs), or AMD-V (for AMD CPUs, but that wasn’t tested). Any
newer i7 core should have Vt-x. Note that you might have to enable it
first from BIOS. You can always check by <code class="language-plaintext highlighter-rouge">lscpu</code> and look for <strong>vmx</strong> flag.</li>
</ul>

<h3 id="tutorials">Tutorials</h3>

<p>Use the following tutorials to learn about the VM:</p>

<ol>
  <li><a href="/Tutorials/camkes-vm-linux.html">Camkes VM Linux</a> using Linux as a guest in the Camkes VM</li>
  <li><a href="/Tutorials/camkes-vm-crossvm.html">Camkes cross-VM connectors</a> walkthrough of adding communication between Linux guests in separate VMs</li>
</ol>

<h3 id="examples">Examples</h3>

<ul>
  <li><a href="centos">Centos</a></li>
  <li><a href="zmq-samples">zmq_samples</a></li>
</ul>

<h3 id="booting-from-hard-drive">Booting from hard drive</h3>

<p>These instructions are for ubuntu. For CentOS instructions, see
<a href="CAmkESVMCentOS">CAmkESVMCentOS</a>.</p>

<p>So far we’ve only run a tiny linux on a ram disk. What if we want to run
Ubuntu booting off a hard drive? This section will explain the changes
we need to make to our VM app to allow it to boot into a Ubuntu
environment installed on the hard drive. Thus far these examples should
have been compatible with most modern x86 machines. The rest of this
tutorial will focus on a particular machine:
<a href="https://www.rtd.com/PC104/CM/CMA34CR/CMA34CR.htm">the cma34cr
single board computer</a></p>

<p>The first step is to install ubuntu natively on the cma34cr. It’s
currently required that guests of the camkes vm run in 32-bit mode, so
install 32-bit ubuntu. These examples will use ubuntu-16.04.</p>

<p>The plan will be to give the guest passthrough access to the hard drive,
and use a ubuntu initrd as our initial root filesystem, replacing the
buildroot one used thus far. We’ll use the same kernel image as before,
as our vm requires that PAE be turned off, and it’s on by default in the
ubuntu kernel.</p>

<h4 id="getting-the-initrd-image">Getting the initrd image</h4>

<p>We need to generate a root filesystem image suitable for ubuntu. Ubuntu
ships with a tool called mkinitramfs which generates root filesystem
images. Let’s use it to generate a root filesystem image compatible with
the linux kernel we’ll be using. Boot ubuntu natively on the cma34cr and
run the following command:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ mkinitramfs -o rootfs.cpio 4.8.16
WARNING: missing /lib/modules/4.8.16
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.8.16: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_H9SRHb/lib/modules/4.8.16/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_H9SRHb/lib/modules/4.8.16/modules.builtin: No such file or directory
</code></pre></div></div>

<p>The kernel we’ll be using has all the necessary drivers built in, so
feel free to ignore those warnings and errors. You should now have a
file called rootfs.cpio on the cma34cr. Transfer that file to your dev
machine, and put it in <code class="language-plaintext highlighter-rouge">projects/vm/minimal</code>. Now we need to tell the
build system to take that rootfs image rather than the default buildroot
one. Edit <code class="language-plaintext highlighter-rouge">projects/vm-examples/minimal/CMakeLists.txt</code>. Change this line:</p>

<div class="language-cmake highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nf">AddToFileServer</span><span class="p">(</span><span class="s2">"rootfs.cpio"</span> <span class="si">${</span><span class="nv">rootfs_file</span><span class="si">}</span><span class="p">)</span>
</code></pre></div></div>
<p>to</p>
<div class="language-cmake highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nf">AddToFileServer</span><span class="p">(</span><span class="s2">"rootfs.cpio"</span> &lt;ROOTFS_FILENAME&gt;<span class="p">)</span>
</code></pre></div></div>
<p>where <code class="language-plaintext highlighter-rouge">&lt;ROOTFS_FILENAME&gt;</code> is replaced with the filename of the rootfs file you 
added in <code class="language-plaintext highlighter-rouge">projects/vm/minimal</code>.</p>

<p>Since we’ll be using a real hard drive, we need to change the boot
command line we give to the guest linux. Open
<code class="language-plaintext highlighter-rouge">projects/vm-examples/minimal/minimal.camkes</code>, and change the
definition of <code class="language-plaintext highlighter-rouge">VM_GUEST_CMDLINE</code> to:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#define VM_GUEST_CMDLINE "earlyprintk=ttyS0,115200 console=ttyS0,115200 i8042.nokbd=y i8042.nomux=y i8042.noaux=y io_delay=udelay noisapnp pci=nomsi debug root=/dev/sda1 rdinit=/init 2"
</code></pre></div></div>

<p>Try building and running after this change:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>BusyBox v1.22.1 (Ubuntu 1:1.22.0-15ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs)
</code></pre></div></div>

<p>You should get dropped into a shell inside the root filesystem. You can
run commands from here:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>(initramfs) pwd
/
(initramfs) ls
dev      run      init     scripts  var      usr      sys      tmp
root     sbin     etc      bin      lib      conf     proc
</code></pre></div></div>

<p>If you look inside <code class="language-plaintext highlighter-rouge">/dev</code>, you’ll notice the lack of sda device. Linux
can’t find the hard drive because we haven’t passed it through yet.
Let’s do that now!</p>

<p>We’re going to give the guest passthrough access to the sata controller.
The sata controller will be in one of two modes: AHCI or IDE. The mode
can be set when configuring BIOS. By default it should be AHCI. The next
part has some minor differences depending on the mode. I’ll show both.
Open <code class="language-plaintext highlighter-rouge">projects/vm-examples/minimal/minimal.camkes</code> and add the following to the
configuration section:</p>

<p>For AHCI:</p>
<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">configuration</span> <span class="p">{</span>
    <span class="p">...</span>

    <span class="n">vm0_config</span><span class="p">.</span><span class="n">pci_devices_iospace</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>


    <span class="n">vm0_config</span><span class="p">.</span><span class="n">ioports</span> <span class="o">=</span> <span class="p">[</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4088</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x4090</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4094</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x4098</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4080</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x4088</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4060</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x4080</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">];</span>
    
    <span class="n">vm0_config</span><span class="p">.</span><span class="n">pci_devices</span> <span class="o">=</span> <span class="p">[</span> 
        <span class="p">{</span>   
            <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span>
            <span class="s">"bus"</span><span class="o">:</span><span class="mi">0</span><span class="p">,</span>
            <span class="s">"dev"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span>
            <span class="s">"fun"</span><span class="o">:</span><span class="mi">2</span><span class="p">,</span>
            <span class="s">"irq"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span>
            <span class="s">"memory"</span><span class="o">:</span><span class="p">[</span>
                <span class="p">{</span><span class="s">"paddr"</span><span class="o">:</span><span class="mh">0xc0713000</span><span class="p">,</span> <span class="s">"size"</span><span class="o">:</span><span class="mh">0x800</span><span class="p">,</span> <span class="s">"page_bits"</span><span class="o">:</span><span class="mi">12</span><span class="p">},</span>
            <span class="p">],</span>
        <span class="p">},</span>  
    <span class="p">];</span>

    <span class="n">vm0_config</span><span class="p">.</span><span class="n">irqs</span> <span class="o">=</span> <span class="p">[</span> 
        <span class="p">{</span><span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span> <span class="s">"source"</span><span class="o">:</span><span class="mi">19</span><span class="p">,</span> <span class="s">"level_trig"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"active_low"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"dest"</span><span class="o">:</span><span class="mi">11</span><span class="p">},</span>
    <span class="p">];</span>
<span class="p">}</span>
</code></pre></div></div>

<p>For IDE:</p>
<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">configuration</span> <span class="p">{</span>
    <span class="p">...</span>

    <span class="n">vm0_config</span><span class="p">.</span><span class="n">pci_devices_iospace</span> <span class="o">=</span> <span class="mi">1</span>

    <span class="n">vm0_config</span><span class="p">.</span><span class="n">ioports</span> <span class="o">=</span> <span class="p">[</span> 
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4080</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x4090</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4090</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40a0</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40b0</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40b8</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40b8</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40c0</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40c8</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40cc</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
        <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40cc</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40d0</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">];</span>  

    <span class="n">vm0_config</span><span class="p">.</span><span class="n">pci_devices</span> <span class="o">=</span> <span class="p">[</span> 
        <span class="p">{</span>   
            <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span>
            <span class="s">"bus"</span><span class="o">:</span><span class="mi">0</span><span class="p">,</span>
            <span class="s">"dev"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span>
            <span class="s">"fun"</span><span class="o">:</span><span class="mi">2</span><span class="p">,</span>
            <span class="s">"irq"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span>
            <span class="s">"memory"</span><span class="o">:</span><span class="p">[],</span>
        <span class="p">},</span>  
    <span class="p">];</span>  

    <span class="n">vm0_config</span><span class="p">.</span><span class="n">irqs</span> <span class="o">=</span> <span class="p">[</span> 
        <span class="p">{</span><span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span> <span class="s">"source"</span><span class="o">:</span><span class="mi">19</span><span class="p">,</span> <span class="s">"level_trig"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"active_low"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"dest"</span><span class="o">:</span><span class="mi">11</span><span class="p">},</span>
    <span class="p">];</span>
<span class="p">}</span>
</code></pre></div></div>

<p>Now rebuild and run:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Ubuntu 16.04.1 LTS ertos-CMA34CR ttyS0

ertos-CMA34CR login: 
</code></pre></div></div>

<p>You should be able to log in and use the system largely as normal.</p>

<h3 id="passthrough-ethernet">Passthrough Ethernet</h3>

<p>The ethernet device is not accessible to the guest:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: sit0@NONE: &lt;NOARP&gt; mtu 1480 qdisc noop state DOWN group default qlen 1
    link/sit 0.0.0.0 brd 0.0.0.0
</code></pre></div></div>

<p>An easy way to give the guest network access is to give it passthrough
access to the ethernet controller. This is done much in the same way as
enabling passthrough access to the sata controller. In the configuration
section in <code class="language-plaintext highlighter-rouge">projects/vm-examples/minimal/minimal.camkes</code>, add to the list of io
ports, pci devices and irqs to pass through:</p>
<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">vm0_config</span><span class="p">.</span><span class="n">ioports</span> <span class="o">=</span> <span class="p">[</span>
    <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4080</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x4090</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x4090</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40a0</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40b0</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40b8</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40b8</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40c0</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40c8</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40cc</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x40cc</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x40d0</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">},</span>
    <span class="p">{</span><span class="s">"start"</span><span class="o">:</span><span class="mh">0x3000</span><span class="p">,</span> <span class="s">"end"</span><span class="o">:</span><span class="mh">0x3020</span><span class="p">,</span> <span class="s">"pci_device"</span><span class="o">:</span><span class="mi">0</span><span class="p">,</span> <span class="s">"name"</span><span class="o">:</span><span class="s">"Ethernet5"</span><span class="p">},</span> <span class="c1">// &lt;--- Add this entry</span>
<span class="p">];</span>

<span class="n">vm0_config</span><span class="p">.</span><span class="n">pci_devices</span> <span class="o">=</span> <span class="p">[</span>
    <span class="p">{</span>   
        <span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span>
        <span class="s">"bus"</span><span class="o">:</span><span class="mi">0</span><span class="p">,</span>
        <span class="s">"dev"</span><span class="o">:</span><span class="mh">0x1f</span><span class="p">,</span>
        <span class="s">"fun"</span><span class="o">:</span><span class="mi">2</span><span class="p">,</span>
        <span class="s">"irq"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span>
        <span class="s">"memory"</span><span class="o">:</span><span class="p">[],</span>
    <span class="p">},</span>

    <span class="c1">// Add this entry:</span>
    <span class="p">{</span>
        <span class="s">"name"</span><span class="o">:</span><span class="s">"Ethernet5"</span><span class="p">,</span>
        <span class="s">"bus"</span><span class="o">:</span><span class="mi">5</span><span class="p">,</span>
        <span class="s">"dev"</span><span class="o">:</span><span class="mi">0</span><span class="p">,</span>
        <span class="s">"fun"</span><span class="o">:</span><span class="mi">0</span><span class="p">,</span>
        <span class="s">"irq"</span><span class="o">:</span><span class="s">"Ethernet5"</span><span class="p">,</span>
        <span class="s">"memory"</span><span class="o">:</span><span class="p">[</span>
            <span class="p">{</span><span class="s">"paddr"</span><span class="o">:</span><span class="mh">0xc0500000</span><span class="p">,</span> <span class="s">"size"</span><span class="o">:</span><span class="mh">0x20000</span><span class="p">,</span> <span class="s">"page_bits"</span><span class="o">:</span><span class="mi">12</span><span class="p">},</span>
            <span class="p">{</span><span class="s">"paddr"</span><span class="o">:</span><span class="mh">0xc0520000</span><span class="p">,</span> <span class="s">"size"</span><span class="o">:</span><span class="mh">0x4000</span><span class="p">,</span> <span class="s">"page_bits"</span><span class="o">:</span><span class="mi">12</span><span class="p">},</span>
        <span class="p">],</span>
    <span class="p">},</span>
<span class="p">];</span>

<span class="n">vm0_config</span><span class="p">.</span><span class="n">irqs</span> <span class="o">=</span> <span class="p">[</span>
    <span class="p">{</span><span class="s">"name"</span><span class="o">:</span><span class="s">"SATA"</span><span class="p">,</span> <span class="s">"source"</span><span class="o">:</span><span class="mi">19</span><span class="p">,</span> <span class="s">"level_trig"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"active_low"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"dest"</span><span class="o">:</span><span class="mi">11</span><span class="p">},</span>
    <span class="p">{</span><span class="s">"name"</span><span class="o">:</span><span class="s">"Ethernet5"</span><span class="p">,</span> <span class="s">"source"</span><span class="o">:</span><span class="mh">0x11</span><span class="p">,</span> <span class="s">"level_trig"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"active_low"</span><span class="o">:</span><span class="mi">1</span><span class="p">,</span> <span class="s">"dest"</span><span class="o">:</span><span class="mi">10</span><span class="p">},</span> <span class="c1">// &lt;--- Add this entry</span>
<span class="p">];</span>
</code></pre></div></div>

<p>You should have added a new entry to each of the three lists that
describe passthrough devices. Building and running:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s2: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:d0:81:09:0c:7d brd ff:ff:ff:ff:ff:ff
    inet 10.13.1.87/23 brd 10.13.1.255 scope global dynamic enp0s2
       valid_lft 14378sec preferred_lft 14378sec
    inet6 2402:1800:4000:1:90b3:f9d:ae22:33b7/64 scope global temporary dynamic 
       valid_lft 86390sec preferred_lft 14390sec
    inet6 2402:1800:4000:1:aa67:5925:2cbc:928f/64 scope global mngtmpaddr noprefixroute dynamic 
       valid_lft 86390sec preferred_lft 14390sec
    inet6 fe80::cc47:129d:bdff:a2da/64 scope link 
       valid_lft forever preferred_lft forever
3: sit0@NONE: &lt;NOARP&gt; mtu 1480 qdisc noop state DOWN group default qlen 1
    link/sit 0.0.0.0 brd 0.0.0.0
$ ping google.com
PING google.com (172.217.25.142) 56(84) bytes of data.
64 bytes from syd15s03-in-f14.1e100.net (172.217.25.142): icmp_seq=1 ttl=51 time=2.17 ms
64 bytes from syd15s03-in-f14.1e100.net (172.217.25.142): icmp_seq=2 ttl=51 time=1.95 ms
64 bytes from syd15s03-in-f14.1e100.net (172.217.25.142): icmp_seq=3 ttl=51 time=1.99 ms
64 bytes from syd15s03-in-f14.1e100.net (172.217.25.142): icmp_seq=4 ttl=51 time=2.20 ms
</code></pre></div></div>

<h3 id="figuring-out-information-about-pci-devices">Figuring out information about PCI devices</h3>

<p>To add a new passthrough device, or access a pci device in general, we
need to know which io ports it uses, which interrupts it’s associated
with, and the physical addresses of any memory-mapped io regions it
uses. The easiest way to find this information is to boot linux
natively, and run the command <code class="language-plaintext highlighter-rouge">lspci -vv</code>.</p>

<h3 id="configuring-a-linux-kernel-build">Configuring a Linux kernel build</h3>

<p>We provide a custom kernel image with our CAmkES VM project, found <a href="https://github.com/seL4/camkes-vm-linux/tree/master/images/kernel">here</a>.
This kernel image is produced from building Linux 4.8.16, specifically configured with the following <a href="https://github.com/seL4/camkes-vm-linux/tree/master/linux_configs/4.8.16">.config file</a>.</p>

<p>However you may decide to build your own Linux kernel image (which may be a different version). When doing so, it is important to ensure the build is configured with the following Kbuild settings:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># General kernel settings
CONFIG_X86_32=y
CONFIG_X86=y
CONFIG_X86_32_SMP=n
CONFIG_SMP=n
CONFIG_NOHIGHMEM=y
CONFIG_PCI_MSI=n
CONFIG_X86_UP_APIC=n
# Power management and ACPI settings
CONFIG_SUSPEND=n
CONFIG_HIBERNATION=n
CONFIG_PM=n
CONFIG_ACPI=n
# Virtio Settings
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_NET=y
</code></pre></div></div>

<p>You can configure these settings by either manually editing your kernel <code class="language-plaintext highlighter-rouge">.config</code> file in the root project directory or by interactively running <code class="language-plaintext highlighter-rouge">make menuconfig</code>.</p>

  </div>







  
    
<div class="sidebar-toc hidden-xs hidden-sm col-md-3 col-lg-3">
    <ul id="toc" class="section-nav">
<li class="toc-entry toc-h2"><a href="#getting-and-building">Getting and Building</a>
<ul>
<li class="toc-entry toc-h3"><a href="#cloning-the-repository-set-and-preparing-a-build-directory">Cloning the repository set and preparing a build directory</a></li>
<li class="toc-entry toc-h3"><a href="#building-for-arm">Building for Arm</a></li>
<li class="toc-entry toc-h3"><a href="#building-for-x86">Building for x86</a></li>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#camkes-arm-vmm-applications">CAmkES ARM VMM Applications</a></li>
<li class="toc-entry toc-h2"><a href="#camkes-x86-vmm-applications">CAmkES x86 VMM Applications</a></li>
<li class="toc-entry toc-h2"><a href="#arm-features">Arm Features</a></li>
<li class="toc-entry toc-h2"><a href="#arm-platform-configuration-notes">Arm Platform Configuration Notes</a>
<ul>
<li class="toc-entry toc-h3"><a href="#exynos5422-tx1-tx2-zcu102-qemu-arm-virt-configuration">Exynos5422, TX1, TX2, ZCU102, QEMU ARM Virt configuration</a></li>
<li class="toc-entry toc-h3"><a href="#tk1-configuration">TK1 configuration</a>
<ul>
<li class="toc-entry toc-h4"><a href="#wireless-configuration">Wireless Configuration</a></li>
</ul>
</li>
<li class="toc-entry toc-h3"><a href="#tk1-build-notes">TK1 Build Notes</a></li>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#useful-links-for-developing-vm-applications">Useful Links for Developing VM Applications</a></li>
<li class="toc-entry toc-h2"><a href="#arm-faq-and-implementation-notes">Arm FAQ and Implementation Notes</a>
<ul>
<li class="toc-entry toc-h3"><a href="#how-do-i-update-camkes-vm-apps-to-support-platform-x">How do I update camkes-vm-apps to support platform ‘X’</a></li>
<li class="toc-entry toc-h3"><a href="#can-a-single-vmm-component-support-running-multiple-vms">Can a single VMM component support running multiple VM’s?</a></li>
<li class="toc-entry toc-h3"><a href="#how-do-i-enable-smp-support-for-a-vm-instance">How do I enable SMP support for a VM instance?</a></li>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#camkes-x86-vm">CAmkES x86 VM</a>
<ul>
<li class="toc-entry toc-h3"><a href="#prerequisites">Prerequisites</a></li>
<li class="toc-entry toc-h3"><a href="#tutorials">Tutorials</a></li>
<li class="toc-entry toc-h3"><a href="#examples">Examples</a></li>
<li class="toc-entry toc-h3"><a href="#booting-from-hard-drive">Booting from hard drive</a>
<ul>
<li class="toc-entry toc-h4"><a href="#getting-the-initrd-image">Getting the initrd image</a></li>
</ul>
</li>
<li class="toc-entry toc-h3"><a href="#passthrough-ethernet">Passthrough Ethernet</a></li>
<li class="toc-entry toc-h3"><a href="#figuring-out-information-about-pci-devices">Figuring out information about PCI devices</a></li>
<li class="toc-entry toc-h3"><a href="#configuring-a-linux-kernel-build">Configuring a Linux kernel build</a></li>
</ul>
</li>
</ul>
</div>

  
  
<div class="sidebar-toc hidden-xs hidden-sm col-md-3 col-lg-3">
  
    <ul class="section-nav">
    	<h2> camkes-vm </h2> 
        <li>
          
          <a style=" font-weight: bold; " class="" href="/projects/camkes-vm/">
            Documentation homepage
          </a>
        </li>

















    
        <h3>Repositories</h3>
    
        <li>
          <a class="" href="https://github.com/seL4/camkes-vm">
            camkes-vm
          </a>
        </li>

    
        <li>
          <a class="" href="https://github.com/seL4/camkes-vm-examples">
            camkes-vm-examples
          </a>
        </li>

    
        <li>
          <a class="" href="https://github.com/seL4/camkes-vm-examples-manifest">
            camkes-vm-examples-manifest
          </a>
        </li>









  







    
        <h3>Recent Updates</h3>
    
        <li>
          <a style="" href="/updates/camkes-vm/camkes-3.8.x-arm-old.html">
            camkes-3.8.x-compatible-arm-old
          </a>
        </li>

    
        <li>
          <a style="" href="/updates/camkes-vm/camkes-3.8.x.html">
            camkes-3.8.x-compatible
          </a>
        </li>

    </ul>

</div>


</div>

    </main>
    


<footer class="site-footer">

  <h2 class="footer-heading">seL4 docs</h2>

  <div class="footer-col-wrapper">

    <div class="col-md-2">
      



<ul class="social-media-list">
  <li><a href="https://github.com/sel4"><i class="fab fa-github"></i> <span class="username">sel4</span></a></li><li><a href="https://github.com/sel4proj"><i class="fab fa-github"></i> <span class="username">sel4proj</span></a></li>
</ul>

    </div>

    <div class="col-md-8">
      <ul class="list-unstyled">
        <li>
          This site is for displaying seL4 related documentation.  Pull requests are welcome.
        </li>
        
          <li>
            Site last updated: Fri Feb 7 10:17:38 2025 +1100 ee78c8857c
          </li>
          <li>
                Page last updated: Thu Mar 24 14:19:51 2022 +1100 461e5e0896
          </li>
        
      </ul>
    </div>
    <div class="col-md-2">
<a href="https://github.com/seL4/docs/blob/master/projects/camkes-vm/index.md">View page on GitHub</a>
      <br />
      <a href="https://github.com/seL4/docs/edit/master/projects/camkes-vm/index.md">Edit page on GitHub</a>
      <br />
      <a href="/sitemap">Sitemap</a>
    </div>

  </div>

</footer>

  </body>
</html>
